# Maintainer: Anatol Pomozov
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Thomas Krug <t.krug@elektronenpumpe.de>

pkgname=pulseview
pkgver=0.4.2
pkgrel=9
pkgdesc='A Qt based logic analyzer GUI for sigrok'
arch=('loong64' 'x86_64')
url='https://sigrok.org/wiki/Main_Page'
license=('GPL3')
depends=('libsigrok' 'libsigrokdecode' 'qt5-base' 'qt5-svg' 'boost-libs')
makedepends=('cmake' 'boost' 'qt5-tools')
source=("https://sigrok.org/download/source/pulseview/pulseview-$pkgver.tar.gz"
        "qt5.15.patch::https://github.com/sigrokproject/pulseview/commit/ae726b70a7ada9a4be5808e00f0c951318479684.patch"
        glib-2.68.patch)
sha512sums=('79f653c9faad021c03b59b4a519b594190d5558dfb9be60cabcc2a35e991e66b733b337fec58a9248699e7aef0df3be1472c81f93274b25cec1fc6b73f8f033b'
            'e115c29151474d5dc905042ee699542abdcc9db523d45595cf0386f0efb9523b292536972074536cb330ede90b41e1edd591888bceb5155b49657937f87e9087'
            'b48b0ff4cc962a252cb8e1c21f9b0661d33399d99dae2fd7d0bb87da8c0e16cba66b4a8c1797dbb53dfa83eb7050b0248024aa013edaecf40183bad39d10e243')

prepare() {
  cd $pkgname-$pkgver

  patch -p1 < ../qt5.15.patch

  # https://github.com/sigrokproject/pulseview/pull/39
  patch -p1 < ../glib-2.68.patch
}

build() {
  cd $pkgname-$pkgver

  cmake . \
  	-DCMAKE_INSTALL_PREFIX:PATH=/usr \
  	-DCMAKE_CXX_FLAGS=-fext-numeric-literals \
  	-DDISABLE_WERROR=ON -DENABLE_TESTS=OFF

  make
}

package() {
  cd $pkgname-$pkgver

  make DESTDIR="$pkgdir" install
}
